<?php

namespace Yolo\Components\EventDispatcher\Annotations;

use Attribute;

#[Attribute(Attribute::TARGET_METHOD)]
class EventDispatcher
{
    /**
     * Mark a method as an event dispatcher.
     * @param string $topic The topic to publish the event
     * @param string $endpoint The endpoint to publish the event
     */
    public function __construct(
        protected string $topic,
        protected string $endpoint = 'instance'
    ) {
    }

    public function getTopic(): string
    {
        return $this->topic;
    }

    public function getEndpoint(): string
    {
        return $this->endpoint;
    }
}
